<?php
class Companydata_Model_Pagedecision implements Commentmanager_Model_Mainable{
    
    private $action_handler;
    
    public function main(array $variables = null) {
        switch ($variables['get']['page']){
            case 'wstaw-dane':
                return $this->insert_user_data($variables);
                break;
            case 'aktualizuj-dane':
                return $this->update_user_data($variables);
                break;
            default :
                return $this->default_action($variables);
                break;
        }
    }
    
    private function update_user_data(array $variables = null){
        $this->action_handler = new Companydata_Model_Updatecompanydata;
        return $this->action_handler->main($variables);
    }
    
    private function insert_user_data(array $variables = null){
        $this->action_handler = new Companydata_Model_Insertcompanydata;
        return $this->action_handler->main($variables);
    }
    
    private function default_action(array $variables = null){
        unset($variables['get']);
        $this->action_handler = new Companydata_Model_Companydata;
        return $this->action_handler->main($variables);
    }
    
}
